package jmh;

import java.util.HashMap;
import java.util.Map;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Warmup;

/***
 * @author zsh
 * @since 1.0 2021/7/11 18:09
 */
public class JMHTest_01 {

    private static final Map<String, String> map;

    static {
        map = new HashMap<>();
        for (int i = 0; i < 1000000; i++) {
            map.put("zsh" + i, "fun");
        }
    }

    @Benchmark
    @Warmup(iterations = 1, time = 2)
    @BenchmarkMode(Mode.Throughput)
    @Measurement(iterations = 1, time = 3)
    public void test_01() {
        map.get("zsh9");
    }
}
